package com.marvels.approve.credit.controller;

import com.marvels.approve.process.service.AttachmentInfoService;
import com.marvels.common.exception.MarvelsBusinessException;
import com.marvels.common.utils.MarvelsLogUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/approve/credit/intbank/service")
public class ApproveIntBankController {
	
	@Autowired
	private AttachmentInfoService attachmentInfoService;

	
	@RequestMapping("loadAttachmentById/{id}")
	@ResponseBody
	public void loadAttachmentById(@PathVariable("id") Long id,HttpServletRequest request,HttpServletResponse response){
		try {
			attachmentInfoService.loadAttachmentById(id, request, response);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error("征信报告审核 读取附件异常, 附件id="+id, e);
		}catch (Exception e) {
			MarvelsLogUtil.getInstance().error("征信报告审核 读取附件异常, 附件id="+id, e);
		}
	}
}
